<template>
  <div>
    <van-nav-bar title="搜索" left-arrow @click-left="onClickLeft" />
    <form action="/" style="height:1rem;font-size:0.5rem">
      <van-search v-model="value" placeholder="请输入搜索关键词" @search="onSearch" @blur="blur()" />
    </form>
    <div style="width:50%;height:4rem;padding:0 0.15rem">
        <h2 @click="jilu()">历史记录</h2>
        <h2 style="position:absolute;right:0.15rem;top:2.15rem" @click="del()">清除记录</h2>
        <ul style="display:flex;flex-wrap:wrap">
        <li v-for='item in list' v-show="isshow" style="margin-right:.3rem;height:.5rem">
            <span @click="tap(item.goodsId)">{{item.brand}}</span>
        </li>
      </ul>
    </div>
    
  </div>
</template>
<script>
import axios from 'axios';
export default {
  name: "Found",
  data() {
    return {
      value:'',
      list:[],
      isshow:true,
    };
  },
  methods: {
    onSearch() {},
    onClickLeft() {
      this.$router.go(-1);
    },
    blur(){
      axios({
        url:'http://47.102.221.184:8083/secluxury/goods/serchgoods',
        params:{
          brandId:this.value
        }
      }).then(data=>{
        console.log(data)
        this.list=data.data
      })
      this.value=''
    },
    del(){
      this.list=[]
      this.value=''
    },
    jilu(){
      this.isshow=true
    },
     tap(id) {
      this.$router.push("/details/"+id);
    },
  }
};
</script>
<style  scoped>
</style>
